package com.twt.recruit.task;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.twt.recruit.entity.Project;
import com.twt.recruit.mapper.ProjectMapper;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.sql.Timestamp;

@Component
public class ProjectTask {

    @Scheduled(cron = "0 0 2 * * ?")
    public void updateProjectStatus(){
        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        LambdaUpdateWrapper<Project> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.lt(Project::getEndTime, timestamp);
        updateWrapper.set(Project::getStatus, 2);
    }
}
